package com.lap.auth.domain.region.service;

import com.lap.auth.domain.region.Region;
import com.lap.auth.domain.region.repository.RegionRepository;
import com.lap.auth.domain.shared.errors.UserError;
import com.lap.framework.exception.BizException;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class RegionValidator {

  private final RegionRepository regionRepository;

  public Region assertRegionExists(Integer id) {
    return regionRepository.findById(id)
        .orElseThrow(() -> BizException.newBiz(UserError.REGION_NOT_FOUND));
  }
}
